<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/html/js/axios.min.js"></script>
    <script src="/html/js/ajax.js"></script>
    <script src="/html/js/util.js"></script>
    <script>
        async function add() {
            let param = {
                name: getObject("name").value,
                pwd: getObject("pwd").value,
                money: getObject("money").value,
                phone: getObject("phone").value,
                email: getObject("email").value
            };
            let info = await ajaxPost("/user/add", param);
            if (info=="ok"){
                alert("添加成功")
            }else {
                console.log(info);
                console.log("typeof"+typeof info);

                let str="";
                for (let i=0;i<info.length;i++){
                    str+=`${info[i].defaultMessage}<br>`
                }
                getObject("errorDiv").innerHTML=str;
            }
        }
    </script>
</head>
<body>
<div id="errorDiv" style="color: red"></div>
姓名:<input type="text" id="name"><br>
密码:<input type="text" id="pwd"><br>
工资:<input type="text" id="money"><br>
电话:<input type="text" id="phone"><br>
邮箱:<input type="text" id="email"><br>
<input type="button" value="添加" onclick="add()"><br>
</body>
</html>